/*
 * sum_n_a.c calculate s = a + aa + aaa + ... + aaa...aaa
*/

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
	unsigned int n, a;
	unsigned int ax, i;
	
	unsigned long sum = 0;

	printf("please input n and a\n");
	scanf("%d,%d", &n, &a);

	ax = a;

	for (i = 1; i < n + 1; i++) {
		sum = sum + ax;
		ax = ax*10 +a;
	}

	printf("sum=%ld\n", sum);

	return 0;
	
}
